<template>
  <div class="count">
    <p ref="countEle">{{ count }}</p>
    <button @click="addCount">累加</button>
    <button @click="getRefs">获取refs</button>
  </div>
</template>

<script>
export default {
  name: "MyCount",
  data() {
    return {
      count: 1,
    };
  },
  methods: {
    addCount() {
      this.count++;
    },
    getRefs(){
      console.log(this.$refs.countEle);
    }
  },
};
</script>

<style scoped>
.count {
  background-color: aqua;
}
</style>